<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActiveRecord::ConnectionAdapters::Column</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActiveRecord::ConnectionAdapters::Column</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions_rb.html">
                vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
An abstract definition of a column in a table.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M001464">binary_to_string</a>&nbsp;&nbsp;
      <a href="#M001462">extract_default</a>&nbsp;&nbsp;
      <a href="#M001475">fallback_string_to_date</a>&nbsp;&nbsp;
      <a href="#M001476">fallback_string_to_time</a>&nbsp;&nbsp;
      <a href="#M001473">fast_string_to_date</a>&nbsp;&nbsp;
      <a href="#M001474">fast_string_to_time</a>&nbsp;&nbsp;
      <a href="#M001457">has_default?</a>&nbsp;&nbsp;
      <a href="#M001461">human_name</a>&nbsp;&nbsp;
      <a href="#M001458">klass</a>&nbsp;&nbsp;
      <a href="#M001470">microseconds</a>&nbsp;&nbsp;
      <a href="#M001454">new</a>&nbsp;&nbsp;
      <a href="#M001471">new_date</a>&nbsp;&nbsp;
      <a href="#M001472">new_time</a>&nbsp;&nbsp;
      <a href="#M001456">number?</a>&nbsp;&nbsp;
      <a href="#M001463">string_to_binary</a>&nbsp;&nbsp;
      <a href="#M001465">string_to_date</a>&nbsp;&nbsp;
      <a href="#M001467">string_to_dummy_time</a>&nbsp;&nbsp;
      <a href="#M001466">string_to_time</a>&nbsp;&nbsp;
      <a href="#M001455">text?</a>&nbsp;&nbsp;
      <a href="#M001459">type_cast</a>&nbsp;&nbsp;
      <a href="#M001460">type_cast_code</a>&nbsp;&nbsp;
      <a href="#M001468">value_to_boolean</a>&nbsp;&nbsp;
      <a href="#M001469">value_to_decimal</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">

    <div id="class-list">
      <h3 class="section-bar">Classes and Modules</h3>

      Module <a href="Column/Format.html" class="link">ActiveRecord::ConnectionAdapters::Column::Format</a><br />

    </div>

    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">TRUE_VALUES</td>
          <td>=</td>
          <td class="context-item-value">[true, 1, '1', 't', 'T', 'true', 'TRUE'].to_set</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">default</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">limit</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">name</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">null</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">precision</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">primary</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">scale</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">sql_type</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">type</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M001464" class="method-detail">
        <a name="M001464"></a>

        <div class="method-heading">
          <a href="#M001464" class="method-signature">
          <span class="method-name">binary_to_string</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Used to convert from BLOBs to Strings
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001464-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001464-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 118</span>
118:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">binary_to_string</span>(<span class="ruby-identifier">value</span>)
119:           <span class="ruby-identifier">value</span>
120:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001454" class="method-detail">
        <a name="M001454"></a>

        <div class="method-heading">
          <a href="#M001454" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(name, default, sql_type = nil, null = true)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Instantiates a <a href="Column.html#M001454">new</a> column in the table.
</p>
<p>
<tt>name</tt> is the column&#8216;s name, such as <tt>supplier_id</tt> in
<tt>supplier_id int(11)</tt>. <tt>default</tt> is the type-casted default
value, such as <tt><a href="Column.html#M001454">new</a></tt> in
<tt>sales_stage varchar(20) default &#8216;<a
href="Column.html#M001454">new</a>&#8216;</tt>. <tt>sql_type</tt> is only
used to extract the column&#8216;s length, if necessary. For example +60+
in <tt>company_name varchar(60)</tt>. <tt>null</tt> determines if this
column allows <tt>NULL</tt> values.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001454-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001454-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 26</span>
26:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">default</span>, <span class="ruby-identifier">sql_type</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">null</span> = <span class="ruby-keyword kw">true</span>)
27:         <span class="ruby-ivar">@name</span>, <span class="ruby-ivar">@sql_type</span>, <span class="ruby-ivar">@null</span> = <span class="ruby-identifier">name</span>, <span class="ruby-identifier">sql_type</span>, <span class="ruby-identifier">null</span>
28:         <span class="ruby-ivar">@limit</span>, <span class="ruby-ivar">@precision</span>, <span class="ruby-ivar">@scale</span> = <span class="ruby-identifier">extract_limit</span>(<span class="ruby-identifier">sql_type</span>), <span class="ruby-identifier">extract_precision</span>(<span class="ruby-identifier">sql_type</span>), <span class="ruby-identifier">extract_scale</span>(<span class="ruby-identifier">sql_type</span>)
29:         <span class="ruby-ivar">@type</span> = <span class="ruby-identifier">simplified_type</span>(<span class="ruby-identifier">sql_type</span>)
30:         <span class="ruby-ivar">@default</span> = <span class="ruby-identifier">extract_default</span>(<span class="ruby-identifier">default</span>)
31: 
32:         <span class="ruby-ivar">@primary</span> = <span class="ruby-keyword kw">nil</span>
33:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001463" class="method-detail">
        <a name="M001463"></a>

        <div class="method-heading">
          <a href="#M001463" class="method-signature">
          <span class="method-name">string_to_binary</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Used to convert from Strings to BLOBs
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001463-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001463-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 113</span>
113:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">string_to_binary</span>(<span class="ruby-identifier">value</span>)
114:           <span class="ruby-identifier">value</span>
115:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001465" class="method-detail">
        <a name="M001465"></a>

        <div class="method-heading">
          <a href="#M001465" class="method-signature">
          <span class="method-name">string_to_date</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001465-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001465-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 122</span>
122:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">string_to_date</span>(<span class="ruby-identifier">string</span>)
123:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">string</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
124:           <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">empty?</span>
125: 
126:           <span class="ruby-identifier">fast_string_to_date</span>(<span class="ruby-identifier">string</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">fallback_string_to_date</span>(<span class="ruby-identifier">string</span>)
127:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001467" class="method-detail">
        <a name="M001467"></a>

        <div class="method-heading">
          <a href="#M001467" class="method-signature">
          <span class="method-name">string_to_dummy_time</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001467-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001467-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 136</span>
136:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">string_to_dummy_time</span>(<span class="ruby-identifier">string</span>)
137:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">string</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
138:           <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">empty?</span>
139: 
140:           <span class="ruby-identifier">string_to_time</span> <span class="ruby-node">&quot;2000-01-01 #{string}&quot;</span>
141:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001466" class="method-detail">
        <a name="M001466"></a>

        <div class="method-heading">
          <a href="#M001466" class="method-signature">
          <span class="method-name">string_to_time</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001466-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001466-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 129</span>
129:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">string_to_time</span>(<span class="ruby-identifier">string</span>)
130:           <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">string</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
131:           <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span>.<span class="ruby-identifier">empty?</span>
132: 
133:           <span class="ruby-identifier">fast_string_to_time</span>(<span class="ruby-identifier">string</span>) <span class="ruby-operator">||</span> <span class="ruby-identifier">fallback_string_to_time</span>(<span class="ruby-identifier">string</span>)
134:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001468" class="method-detail">
        <a name="M001468"></a>

        <div class="method-heading">
          <a href="#M001468" class="method-signature">
          <span class="method-name">value_to_boolean</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
convert something to a boolean
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001468-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001468-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 144</span>
144:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value_to_boolean</span>(<span class="ruby-identifier">value</span>)
145:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">blank?</span>
146:             <span class="ruby-keyword kw">nil</span>
147:           <span class="ruby-keyword kw">else</span>
148:             <span class="ruby-constant">TRUE_VALUES</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">value</span>)
149:           <span class="ruby-keyword kw">end</span>
150:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001469" class="method-detail">
        <a name="M001469"></a>

        <div class="method-heading">
          <a href="#M001469" class="method-signature">
          <span class="method-name">value_to_decimal</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
convert something to a BigDecimal
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001469-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001469-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 153</span>
153:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value_to_decimal</span>(<span class="ruby-identifier">value</span>)
154:           <span class="ruby-comment cmt"># Using .class is faster than .is_a? and</span>
155:           <span class="ruby-comment cmt"># subclasses of BigDecimal will be handled</span>
156:           <span class="ruby-comment cmt"># in the else clause</span>
157:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">BigDecimal</span>
158:             <span class="ruby-identifier">value</span>
159:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:to_d</span>)
160:             <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_d</span>
161:           <span class="ruby-keyword kw">else</span>
162:             <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">to_d</span>
163:           <span class="ruby-keyword kw">end</span>
164:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Class methods</h3>

      <div id="method-M001475" class="method-detail">
        <a name="M001475"></a>

        <div class="method-heading">
          <a href="#M001475" class="method-signature">
          <span class="method-name">fallback_string_to_date</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001475-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001475-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 200</span>
200:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fallback_string_to_date</span>(<span class="ruby-identifier">string</span>)
201:             <span class="ruby-identifier">new_date</span>(<span class="ruby-operator">*</span><span class="ruby-operator">::</span><span class="ruby-constant">Date</span>.<span class="ruby-identifier">_parse</span>(<span class="ruby-identifier">string</span>, <span class="ruby-keyword kw">false</span>).<span class="ruby-identifier">values_at</span>(<span class="ruby-identifier">:year</span>, <span class="ruby-identifier">:mon</span>, <span class="ruby-identifier">:mday</span>))
202:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001476" class="method-detail">
        <a name="M001476"></a>

        <div class="method-heading">
          <a href="#M001476" class="method-signature">
          <span class="method-name">fallback_string_to_time</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001476-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001476-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 204</span>
204:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fallback_string_to_time</span>(<span class="ruby-identifier">string</span>)
205:             <span class="ruby-identifier">time_hash</span> = <span class="ruby-constant">Date</span>.<span class="ruby-identifier">_parse</span>(<span class="ruby-identifier">string</span>)
206:             <span class="ruby-identifier">time_hash</span>[<span class="ruby-identifier">:sec_fraction</span>] = <span class="ruby-identifier">microseconds</span>(<span class="ruby-identifier">time_hash</span>)
207: 
208:             <span class="ruby-identifier">new_time</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">time_hash</span>.<span class="ruby-identifier">values_at</span>(<span class="ruby-identifier">:year</span>, <span class="ruby-identifier">:mon</span>, <span class="ruby-identifier">:mday</span>, <span class="ruby-identifier">:hour</span>, <span class="ruby-identifier">:min</span>, <span class="ruby-identifier">:sec</span>, <span class="ruby-identifier">:sec_fraction</span>))
209:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001473" class="method-detail">
        <a name="M001473"></a>

        <div class="method-heading">
          <a href="#M001473" class="method-signature">
          <span class="method-name">fast_string_to_date</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001473-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001473-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 186</span>
186:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fast_string_to_date</span>(<span class="ruby-identifier">string</span>)
187:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Format</span><span class="ruby-operator">::</span><span class="ruby-constant">ISO_DATE</span>
188:               <span class="ruby-identifier">new_date</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>
189:             <span class="ruby-keyword kw">end</span>
190:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001474" class="method-detail">
        <a name="M001474"></a>

        <div class="method-heading">
          <a href="#M001474" class="method-signature">
          <span class="method-name">fast_string_to_time</span><span class="method-args">(string)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Doesn&#8216;t handle time zones.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001474-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001474-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 193</span>
193:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fast_string_to_time</span>(<span class="ruby-identifier">string</span>)
194:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">string</span> <span class="ruby-operator">=~</span> <span class="ruby-constant">Format</span><span class="ruby-operator">::</span><span class="ruby-constant">ISO_DATETIME</span>
195:               <span class="ruby-identifier">microsec</span> = (<span class="ruby-identifier">$7</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">*</span> <span class="ruby-value">1_000_000</span>).<span class="ruby-identifier">to_i</span>
196:               <span class="ruby-identifier">new_time</span> <span class="ruby-identifier">$1</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$2</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$3</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$4</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$5</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">$6</span>.<span class="ruby-identifier">to_i</span>, <span class="ruby-identifier">microsec</span>
197:             <span class="ruby-keyword kw">end</span>
198:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001470" class="method-detail">
        <a name="M001470"></a>

        <div class="method-heading">
          <a href="#M001470" class="method-signature">
          <span class="method-name">microseconds</span><span class="method-args">(time)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
&#8216;0.123456&#8217; -&gt; 123456 &#8216;1.123456&#8217; -&gt; 123456
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001470-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001470-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 169</span>
169:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">microseconds</span>(<span class="ruby-identifier">time</span>)
170:             ((<span class="ruby-identifier">time</span>[<span class="ruby-identifier">:sec_fraction</span>].<span class="ruby-identifier">to_f</span> <span class="ruby-operator">%</span> <span class="ruby-value">1</span>) <span class="ruby-operator">*</span> <span class="ruby-value">1_000_000</span>).<span class="ruby-identifier">to_i</span>
171:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001471" class="method-detail">
        <a name="M001471"></a>

        <div class="method-heading">
          <a href="#M001471" class="method-signature">
          <span class="method-name">new_date</span><span class="method-args">(year, mon, mday)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001471-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001471-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 173</span>
173:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_date</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>)
174:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
175:               <span class="ruby-constant">Date</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
176:             <span class="ruby-keyword kw">end</span>
177:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001472" class="method-detail">
        <a name="M001472"></a>

        <div class="method-heading">
          <a href="#M001472" class="method-signature">
          <span class="method-name">new_time</span><span class="method-args">(year, mon, mday, hour, min, sec, microsec)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001472-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001472-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 179</span>
179:           <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">new_time</span>(<span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">microsec</span>)
180:             <span class="ruby-comment cmt"># Treat 0000-00-00 00:00:00 as nil.</span>
181:             <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">year</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">year</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
182: 
183:             <span class="ruby-constant">Time</span>.<span class="ruby-identifier">time_with_datetime_fallback</span>(<span class="ruby-constant">Base</span>.<span class="ruby-identifier">default_timezone</span>, <span class="ruby-identifier">year</span>, <span class="ruby-identifier">mon</span>, <span class="ruby-identifier">mday</span>, <span class="ruby-identifier">hour</span>, <span class="ruby-identifier">min</span>, <span class="ruby-identifier">sec</span>, <span class="ruby-identifier">microsec</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
184:           <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M001462" class="method-detail">
        <a name="M001462"></a>

        <div class="method-heading">
          <a href="#M001462" class="method-signature">
          <span class="method-name">extract_default</span><span class="method-args">(default)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001462-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001462-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 107</span>
107:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extract_default</span>(<span class="ruby-identifier">default</span>)
108:         <span class="ruby-identifier">type_cast</span>(<span class="ruby-identifier">default</span>)
109:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001457" class="method-detail">
        <a name="M001457"></a>

        <div class="method-heading">
          <a href="#M001457" class="method-signature">
          <span class="method-name">has_default?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001457-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001457-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 43</span>
43:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_default?</span>
44:         <span class="ruby-operator">!</span><span class="ruby-identifier">default</span>.<span class="ruby-identifier">nil?</span>
45:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001461" class="method-detail">
        <a name="M001461"></a>

        <div class="method-heading">
          <a href="#M001461" class="method-signature">
          <span class="method-name">human_name</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the human name of the column name.
</p>
<h5>Examples</h5>
<pre>
 Column.new('sales_stage', ...).human_name # =&gt; 'Sales stage'
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001461-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001461-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 103</span>
103:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">human_name</span>
104:         <span class="ruby-constant">Base</span>.<span class="ruby-identifier">human_attribute_name</span>(<span class="ruby-ivar">@name</span>)
105:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001458" class="method-detail">
        <a name="M001458"></a>

        <div class="method-heading">
          <a href="#M001458" class="method-signature">
          <span class="method-name">klass</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the Ruby class that corresponds to the abstract data type.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001458-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001458-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 48</span>
48:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">klass</span>
49:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
50:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:integer</span>       <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Fixnum</span>
51:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:float</span>         <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Float</span>
52:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:decimal</span>       <span class="ruby-keyword kw">then</span> <span class="ruby-constant">BigDecimal</span>
53:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:datetime</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Time</span>
54:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:date</span>          <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Date</span>
55:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:timestamp</span>     <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Time</span>
56:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:time</span>          <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Time</span>
57:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:text</span>, <span class="ruby-identifier">:string</span> <span class="ruby-keyword kw">then</span> <span class="ruby-constant">String</span>
58:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:binary</span>        <span class="ruby-keyword kw">then</span> <span class="ruby-constant">String</span>
59:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:boolean</span>       <span class="ruby-keyword kw">then</span> <span class="ruby-constant">Object</span>
60:         <span class="ruby-keyword kw">end</span>
61:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001456" class="method-detail">
        <a name="M001456"></a>

        <div class="method-heading">
          <a href="#M001456" class="method-signature">
          <span class="method-name">number?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001456-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001456-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 39</span>
39:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">number?</span>
40:         <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:integer</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:float</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:decimal</span>
41:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001455" class="method-detail">
        <a name="M001455"></a>

        <div class="method-heading">
          <a href="#M001455" class="method-signature">
          <span class="method-name">text?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001455-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001455-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 35</span>
35:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">text?</span>
36:         <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:string</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">type</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:text</span>
37:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001459" class="method-detail">
        <a name="M001459"></a>

        <div class="method-heading">
          <a href="#M001459" class="method-signature">
          <span class="method-name">type_cast</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Casts value (which is a String) to an appropriate instance.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001459-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001459-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 64</span>
64:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type_cast</span>(<span class="ruby-identifier">value</span>)
65:         <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
66:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
67:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:string</span>    <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span>
68:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:text</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span>
69:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:integer</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-identifier">value</span> <span class="ruby-operator">?</span> <span class="ruby-value">1</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
70:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:float</span>     <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_f</span>
71:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:decimal</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">value_to_decimal</span>(<span class="ruby-identifier">value</span>)
72:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:datetime</span>  <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_time</span>(<span class="ruby-identifier">value</span>)
73:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:timestamp</span> <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_time</span>(<span class="ruby-identifier">value</span>)
74:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:time</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_dummy_time</span>(<span class="ruby-identifier">value</span>)
75:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:date</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">string_to_date</span>(<span class="ruby-identifier">value</span>)
76:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:binary</span>    <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">binary_to_string</span>(<span class="ruby-identifier">value</span>)
77:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:boolean</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">value_to_boolean</span>(<span class="ruby-identifier">value</span>)
78:           <span class="ruby-keyword kw">else</span> <span class="ruby-identifier">value</span>
79:         <span class="ruby-keyword kw">end</span>
80:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M001460" class="method-detail">
        <a name="M001460"></a>

        <div class="method-heading">
          <a href="#M001460" class="method-signature">
          <span class="method-name">type_cast_code</span><span class="method-args">(var_name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M001460-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M001460-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb, line 82</span>
82:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">type_cast_code</span>(<span class="ruby-identifier">var_name</span>)
83:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">type</span>
84:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:string</span>    <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">nil</span>
85:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:text</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-keyword kw">nil</span>
86:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:integer</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;(#{var_name}.to_i rescue #{var_name} ? 1 : 0)&quot;</span>
87:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:float</span>     <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{var_name}.to_f&quot;</span>
88:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:decimal</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.value_to_decimal(#{var_name})&quot;</span>
89:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:datetime</span>  <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.string_to_time(#{var_name})&quot;</span>
90:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:timestamp</span> <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.string_to_time(#{var_name})&quot;</span>
91:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:time</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.string_to_dummy_time(#{var_name})&quot;</span>
92:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:date</span>      <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.string_to_date(#{var_name})&quot;</span>
93:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:binary</span>    <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.binary_to_string(#{var_name})&quot;</span>
94:           <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:boolean</span>   <span class="ruby-keyword kw">then</span> <span class="ruby-node">&quot;#{self.class.name}.value_to_boolean(#{var_name})&quot;</span>
95:           <span class="ruby-keyword kw">else</span> <span class="ruby-keyword kw">nil</span>
96:         <span class="ruby-keyword kw">end</span>
97:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>